package com.qiqi.mealordersystem.Controller;

import com.qiqi.mealordersystem.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping(value = "user")
public class UserController {

    private UserService service;

    @Autowired
    public UserController(UserService service) {
        this.service = service;
    }

    @RequestMapping(value = "/login/in", method = RequestMethod.POST)
    @ResponseBody
    public void loginIn(String User){

    }

    @RequestMapping(value = "/login/out", method = RequestMethod.POST)
    @ResponseBody
    public void loginOut(String user){

    }

    @RequestMapping(value = "/register", method = RequestMethod.POST)
    public @ResponseBody String  register(@RequestBody String userString){

        String regiseter = service.regiseter(userString);
        return regiseter;

    }

    @RequestMapping(value = "/detail/{userid}")
    @ResponseBody
    public String getUserDetail(@PathVariable String userid){

        String userDetail = service.getUserDetail(userid);
        return userDetail;

    }

}
